﻿<ContentControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:System="clr-namespace:System;assembly=mscorlib"
                xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
                xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                mc:Ignorable="d">
    <Grid>
        <Border Style="{StaticResource ContentBorderStyle}" Visibility="{Binding IsValid, Converter={StaticResource BooleanToVisibilityConverter}}">
            <Grid Style="{StaticResource LayoutRootGridStyle}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <Border Style="{StaticResource NavBrandingBorderStyle}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="100" />
                        </Grid.ColumnDefinitions>

                        <TextBlock FontSize="30"
                                   Style="{StaticResource ApplicationNameStyle}"
                                   Text="泊银科技" />
                        <ContentControl Grid.Column="1"
                                        Grid.ColumnSpan="2"
                                        Style="{StaticResource LogoIcon}">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding CurrentAccount.Name}" />
                                <TextBlock>
                                    <Run Text="（" />
                                    <Run Text="{Binding CurrentRole.Name}" />
                                    <Run Text="）" />
                                </TextBlock>
                            </StackPanel>
                        </ContentControl>
                        <ToggleButton Grid.Column="2"
                                      Margin="0,0,50,0"
                                      HorizontalAlignment="Right"
                                      IsChecked="{Binding ShowAllUrls,
                                                          Mode=TwoWay}"
                                      Style="{StaticResource BrailleButtonStyle}" />
                    </Grid>
                </Border>

                <Border x:Name="LinksBorder" Style="{StaticResource NavLinksBorderStyle}">
                    <ListBox x:Name="LinksStackPanel"
                             ItemContainerStyle="{StaticResource NavigatorStyle}"
                             ItemsSource="{Binding Navigations}"
                             SelectedItem="{Binding SelectedWeburl,
                                                    Mode=TwoWay}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Style="{StaticResource LinksStackPanelStyle}" />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>

                    </ListBox>
                </Border>

                <Border x:Name="ContentBorder" Style="{StaticResource NavContentBorderStyle}">
                    <navigation:Frame x:Name="ContentFrame"
                                      JournalOwnership="OwnsJournal"
                                      Source="{Binding ViewUrl}"
                                      Style="{StaticResource NavContentFrameStyle}" />
                </Border>

                <Border Grid.Row="2"
                        Margin="45,-42,0,0"
                        Padding="58,15,58,15"
                        Visibility="{Binding ShowAllUrls,
                                             Converter={StaticResource BooleanToVisibilityConverter}}">
                    <ListBox ItemsSource="{Binding WeburlCollection}"
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                             SelectedItem="{Binding SelectedWeburl,
                                                    Mode=TwoWay}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Margin="12,6"
                                           FontSize="16"
                                           Text="{Binding Title}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Border>

                <Grid Grid.Row="2"
                      Margin="0,12,0,0"
                      HorizontalAlignment="Left">
                    <ListBox Margin="0"
                             ItemContainerStyle="{StaticResource TopurlItemStyle}"
                             ItemsSource="{Binding TopurlCollection}"
                             ScrollViewer.VerticalScrollBarVisibility="Hidden"
                             SelectedItem="{Binding SelectedTopurl,
                                                    Mode=TwoWay}" />
                </Grid>
            </Grid>
        </Border>

        <Border x:Name="border"
                Grid.Row="2"
                BorderThickness="1"
                Visibility="{Binding IsValid,
                                     Converter={StaticResource BooleanToVisibilityInverseConverter}}">
            <Border.BorderBrush>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Offset="0.02" Color="#FF162C41" />
                    <GradientStop Offset="1" Color="#FF263340" />
                </LinearGradientBrush>
            </Border.BorderBrush>
            <Border.Background>
                <RadialGradientBrush GradientOrigin="0.502,-0.012" RadiusX="0.648">
                    <GradientStop Offset="1" Color="#FF000000" />
                    <GradientStop Color="#FF2B5278" />
                </RadialGradientBrush>
            </Border.Background>
            <Grid x:Name="wallLayout">
                <ListBox x:Name="wall3D"
                         Background="{x:Null}"
                         BorderThickness="0"
                         ItemContainerStyle="{StaticResource Wall3D_ListBoxItemStyle}"
                         ItemsPanel="{StaticResource Wall3D_ItemsPanelTemplate}"
                         ItemsSource="{Binding ImageCollection,
                                               Mode=OneWay}"
                         ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                         ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                <Ellipse x:Name="lightFloor"
                         Width="1258"
                         Height="206"
                         Margin="0,0,0,-93"
                         HorizontalAlignment="Center"
                         VerticalAlignment="Bottom"
                         IsHitTestVisible="False"
                         Opacity="0.3">
                    <Ellipse.Fill>
                        <RadialGradientBrush>
                            <GradientStop Color="#FF1C6EC1" />
                            <GradientStop Offset="1" />
                        </RadialGradientBrush>
                    </Ellipse.Fill>
                </Ellipse>
                <Rectangle x:Name="shadowLeft"
                           Width="300"
                           HorizontalAlignment="Left"
                           IsHitTestVisible="False">
                    <Rectangle.Fill>
                        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                            <GradientStop Color="#CC000000" />
                            <GradientStop Offset="0.996" />
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <Rectangle x:Name="shadowRight"
                           Width="300"
                           HorizontalAlignment="Right"
                           IsHitTestVisible="False"
                           RenderTransformOrigin="0.5,0.5">
                    <Rectangle.Fill>
                        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                            <GradientStop Color="#CC000000" />
                            <GradientStop Offset="0.996" />
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                    <Rectangle.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="-1" />
                            <SkewTransform />
                            <RotateTransform />
                            <TranslateTransform />
                        </TransformGroup>
                    </Rectangle.RenderTransform>
                </Rectangle>
            </Grid>
        </Border>
    </Grid>
</ContentControl>
